package exp1dtree;


public final class TestResult {
	
	public int size = 0;
	public int posSize = 0;
	public int negSize = 0;
	public int truePos = 0;
	public int falsePos = 0;
	public int trueNeg = 0;
	public int falseNeg = 0;
	
	public double getAccuracy() {
		return (truePos + trueNeg) * 1.0 / size;
	}
	
	private double getPosAcc() {
		return truePos * 1.0 / posSize;
	}
	
	private double getNegAcc() {
		return trueNeg * 1.0 / negSize;
	}
	
	public void add(boolean guess, boolean rst) {
		++size;
		if (rst) {
			++posSize;
			if (guess)
				++truePos;
			else
				++falseNeg;
		} else {
			++negSize;
			if (guess)
				++falsePos;
			else
				++trueNeg;
		}
	}
	
	public String toString() {
		return ("\tTotal Accuracy:\t\t" + getAccuracy() + "\n"
				+ "\tPositive Accuracy:\t" + getPosAcc() + "\n"
				+ "\tNegtive Accuracy:\t" + getNegAcc() + "\n");
	}

}
